package com.ynwa.thread;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import javafx.concurrent.Task;

import java.util.Random;
import java.util.concurrent.*;

/**
 * @author gzd
 * @date 2018-11-02 下午 3:49
 * @desc
 */
public class FutrueTest {

    public static void main(String[] args) {
        Callable<Integer> callable = () -> {
            System.out.println();
            Thread.sleep(3000);
            return 998;
        };

        FutureTask<Integer> future = new FutureTask<>(callable);
        new Thread(future).start();
        try {
            System.out.println("=----");
            System.out.println(future.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
